package com.open.capacity.user.controller;

import com.open.capacity.common.model.TitleType;
import com.open.capacity.common.web.PageResult;
import com.open.capacity.common.web.Result;
import com.open.capacity.user.service.TitleTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 称号类型控制层
 * @author liutao
 * @date 2021-02-01 19:04
 */
@RestController
@RequestMapping("/titleType")
@Api(tags = "称号类型管理")
public class TitleTypeController {

    @Autowired
    private TitleTypeService titleTypeService;

    // 模糊查询称号类型
    @PostMapping("/getSelectTitleTypes")
    @ApiOperation(value = "模糊查询称号类型")
    public PageResult getSelectTitleTypes(@RequestParam Map<String, Object> params){
        return titleTypeService.getSelectTitleTypes(params);
    }

    // 添加称号类型
    @PostMapping("/addTitleType")
    @ApiOperation(value = "添加称号类型")
    public Result addTitleType(@RequestBody TitleType titleType){
        return titleTypeService.addTitleType(titleType);
    }

    // 修改称号类型
    @PostMapping("/updateTitleType")
    @ApiOperation(value = "修改称号类型")
    public Result updateTitleType(@RequestBody TitleType titleType){
        return titleTypeService.updateTitleType(titleType);
    }

    // 删除称号类型
    @DeleteMapping("/delTitleType/{tttpid}")
    @ApiOperation(value = "删除称号类型")
    public Result delTitleType(@PathVariable("tttpid") int tttpid){
        return titleTypeService.delTitleType(tttpid);
    }

}
